﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;


 

using Eis51.CampanyCMS.Business.Bus;
using Eis51.CampanyCMS.FrameWork;
using Eis51.CampanyCMS.Business;
using System.Text;
using Eis51.CampanyCMS.Model;
using Eis51.CampanyCMS.Model.Bus;
using Eis51.BuildingHtml.Model;
using Eis51.BuildingHtml;
using System.IO;
using Eis51.Web.Admin;

namespace Eis51.CampanyCMS.UI.Admin.SystemManager
{
    public partial class BuildPage : BasePage
    {
        public string Defaulthomepage = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (AppContext.CurrentAdministrator.Defaulthomepage == string.Empty)
            //{
            //    Defaulthomepage = "#";
            //}
            //else
            //{
            //    Defaulthomepage = Page.ResolveClientUrl(AppContext.CurrentAdministrator.Defaulthomepage);
            //}
            
            //if (!Page.IsPostBack)
            //{
            //    if (AppContext.CurrentAdministrator == null) return;
            //    string path = @"~/{0}/xml/CallMethodArrMod.xml";
            //    if (!string.IsNullOrEmpty(AppContext.CurrentAdministrator.Mytemplatepath))
            //    {
            //        path = Path.Combine(AppContext.CurrentAdministrator.Mytemplatepath, "CallMethodArrMod.xml");
            //    }
            //    else
            //    {
            //        path = @"~/{0}/xml/CallMethodArrMod.xml";
            //        path = string.Format(path, AppContext.GetCurrentName());
            //    }
            //    DataTable dt = BuildPageBLL.GetHtmlPageName(path);
            //    chkList.DataTextField = "name";
            //    chkList.DataValueField = "keyvalue";
            //    chkList.DataSource = dt;
            //    chkList.DataBind();
            //}
        }

        private  void addDataRow(string v,string f,DataTable dt)
        {
            DataRow dr = dt.NewRow();
            dr["fvale"] = v;
            dr["ftext"] = f;
            dt.Rows.Add(dr);
        }

        protected void bntCreate_Click(object sender, EventArgs e)
        {
            //BuildPageBLL.GobalPara(this, AppContext.CurrentAdministrator);
            //string getchkList =","+ CommonControl.GetChecklistSelectValue(chkList)+",";           
            //string path = @"~/{0}/xml/CallMethodArrMod.xml";
            //if (!string.IsNullOrEmpty(AppContext.CurrentAdministrator.Mytemplatepath))
            //{
            //    path = Path.Combine(AppContext.CurrentAdministrator.Mytemplatepath, "CallMethodArrMod.xml");
            //}
            //else
            //{
            //    path = @"~/{0}/xml/CallMethodArrMod.xml";
            //    path = string.Format(path, AppContext.GetCurrentName());
            //}
            //CallMethodArrMod CallArr=new CallMethodArrMod() ;
            //CallArr = XmlData.XmlDeserialize(CallArr.GetType(), path) as CallMethodArrMod;
            //if (CallArr.CurrentEncoding.ToUpper()== "UTF8")
            //{
            //    AppContext.CurrentEncoding = Encoding.UTF8;
            //}
            //else
            //{
            //    AppContext.CurrentEncoding = Encoding.GetEncoding("gb2312");
            //}
            //foreach (CallMethodMod c in CallArr.callmethodmods)
            //{
            //    if (getchkList.IndexOf(c.Name) != -1)
            //    {
            //        FuntionParaMod f = new FuntionParaMod();
            //        f.CycleSql = c.CycleSql ;
            //        f.ParaArr = c.ParaValue;
            //        f.Sql = c.Sql;
            //        f.Type = c.Type;
            //        f.xmlPath = c.xmlPath; 
            //        BuildPageBLL.CreateHtml(f);
            //    }
            //}
        }

        protected void cbAll_CheckedChanged(object sender, EventArgs e)
        {
            foreach (ListItem it in chkList.Items)
            {
                it.Selected = cbAll.Checked;
            }
            
        }
    }
}
